//
//  LTFContentCollectionViewCell.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/14.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "LTFNewsHeadLineCollectionViewCell.h"
#import "LTFNewsHeadLineView.h"

@interface LTFNewsHeadLineCollectionViewCell ()
<
 LTFNewsHeadLineViewDelegate
>
@property (nonatomic, retain) LTFNewsHeadLineView *headLineView;

@end


@implementation LTFNewsHeadLineCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
        [self createData];
    }
    return  self;
}
- (void)setString:(NSString *)string {
    if (_string != string) {
        [_string release];
        _string = [string retain];
        [self createData];
    }
}
- (void)createView {
    self.headLineView = [[LTFNewsHeadLineView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 64 - 50)];
    [self.contentView addSubview:self.headLineView];
    [_headLineView release];
    [self createData];
    _headLineView.delegate = self;

}
- (void)sendHeadAddress:(NSString *)address {
    [self.delegate sendHeadString:address];
}
- (void)sendAddress:(NSString *)address {
    [self.delegate sendString:address];

}
- (void) createData{
    self.headLineView.string = self.string;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.headLineView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 64 - 50);
}
- (void)dealloc
{
    [_headLineView release];
    [super dealloc];
}
@end
